import { ElMessage, ElMessageBox } from "element-plus";

export const DeleteComfirmBox = async () => {
  var flag = false;
  await ElMessageBox.confirm("你将永久删除这条数据，确认吗？", "Warning", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
    center: true,
  })
    .then(() => {
      flag = true;
    })
    .catch(() => {
      flag = false;
      ElMessage({
        type: "info",
        message: "放弃了此次操作",
      });
    });
  return flag;
};

export const AbstractComfirmBox = async (tag = "") => {
  var flag = false;
  await ElMessageBox.confirm("你将执行" + tag + "此操作，确认吗？", "Warning", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
    center: true,
  })
    .then(() => {
      flag = true;
    })
    .catch(() => {
      flag = false;
      ElMessage({
        type: "info",
        message: "放弃了此次操作",
      });
    });
  return flag;
};
